package com.donfelix.looknews.view.implpresenter;

import com.donfelix.looknews.view.presenter.IBasePresenter;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

/**
 * Created by Don on 2017/3/27.
 * Desc
 */

public class BasePresenterImpl implements IBasePresenter {

    private CompositeDisposable disposable;

    protected void addSubscription(Disposable dispos) {
        if (disposable == null) {
            disposable = new CompositeDisposable();
        }
        disposable.add(dispos);
    }

    @Override
    public void unsubscribe() {
        if (disposable != null) {
            disposable.dispose();
        }
    }
}
